home *** CD-ROM | disk | FTP | other *** search
- Path: mars.efn.org!rose_ip187
- From: peterf@gears.efn.org
- Newsgroups: comp.lang.c++
- Subject: re: C++ display Ascii file
- Date: Sun, 21 Jan 96 18:49:47 GMT
- Organization: Oregon Public Networking
- Message-ID: <4duc2n$jlr@mars.efn.org>
- NNTP-Posting-Host: rose_ip187.efn.org
- X-Newsreader: News Xpress Version 1.0 Beta #3
-
- Dear Shane,
-
- Here is some help, I will rewrite your program using diff. method....
-
- #include <fstream.h>
- #include <conio.h>
- #include <process.h>
-
- void foerror(int);
-
- void main(int argc, char* argv[])
- {
- char chr;
-
- if(argc!=2)
- { foerror(argc); }
-
- ifstream infile(argv[1]);
-
- if(!infile)
- {
- cerr << "\nUnable to read " << argv[1] << endl;
- exit(-1);
- }
-
- while(infile)
- {
- infile.get(chr);
- cout << chr;
- }
- }
-
- void foerror(int argc)
- {
- if(argc!=2)
- {
- cerr << "\nExample 1: Drive:\\Your sub-dir\\Ftype Filename" << endl;
- cerr << "or";
- cerr << "\nExample 2: Drive:\\Ftype Filename" << endl;
- exit(-1);
- }
- }
-